import React from 'react';
// import FlatButton from 'material-ui/lib/flat-button';
import RaisedButton from 'material-ui/lib/raised-button';

export default class CheckButton extends React.Component {
	static propTypes = {
		label: React.PropTypes.string.isRequired,
		value: React.PropTypes.any,
		checked: React.PropTypes.bool,
		disabled: React.PropTypes.bool,
		onCheck: React.PropTypes.func
	};

	static defaultProps = {
		disabled: false,
		onCheck: function() { }
	};

	constructor(props) {
		super(props);
	}

	handleChange = (event) => {
		let { checked, onCheck, value } = this.props;
		event.target.value = value;

		onCheck(event, !checked);
	};

	render() {
		let { checked, disabled, label, value } = this.props;

		return (
			<RaisedButton 
				style={{minWidth: 40, margin: '2px 5px', boxShadow: 'none'}}
				secondary={checked} 
				label={label} 
				disabled={disabled}
				onTouchTap={this.handleChange} />
		);
	}
}